package com.bwie.lottoMq;

import com.bwie.common.domain.LottoLog;
import com.bwie.mapper.LottoMapper;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @className: LottoMQ
 * @Description: TODO
 * @version: v1.８.0
 * @author: 汪菲阳
 * @date: 2025/9/12 10:32
 */
@Component
public class LottoMQ {
    @Autowired
    private LottoMapper lottoMapper;

    @RabbitListener(queuesToDeclare = @Queue(name = "addLottoLog"))
    public void addLog(LottoLog lottoLog){
        try {
            lottoMapper.addLottoLog(lottoLog);
            System.out.println("成功消息处理 ："+lottoLog);
        } catch (Exception e) {
            System.out.println("失败消息处理："+lottoLog);
        }
    }
}
